<?php 

namespace App\Repositories;

class DepartmentRepository extends Repository 
{
    public function model() {
        return 'App\Models\Department';
    }

    // 区域
    public function regionLists()
    {
        return $this->model->where('pid', 0)->lists('name', 'id');
    }

    // 区域
    public function regions()
    {
        return $this->model->where('pid', 0)->get();
    }

    public function findIds($id)
    {
    	return $this->model->where('pid', $id)->lists('id')->toArray();
    }

    public function getCountByRegion($id)
    {
    	return $this->model->where('pid', $id)->count();
    }
}